﻿<?php
/*********************************************************************\
* This File is a part of BH-PANEL (Breizh-Heberg Panel v2.1)
* Copyright (C) 2008-2009 the BH Developpers : Vincent Giersch <mail@vincordi.fr>, Cyprien Laleau <fanning.fr@gmail.com> and Edwin Cabiten <marmottes44@hotmail.fr>
* See file AUTHORS to get more informations

* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
/*********************************************************************/

if($_SESSION['u_auth'] > 7) {
	$title = "Administration - membres";
	$tplinc = "admin-users-front";
	$parse = 1;
	
	$_list = query("SELECT 
					users.*,
					users.u_nic AS nic,
					comptes_heberg.u_nic,
					COUNT(comptes_heberg.id),
					COUNT(comptes_domain.id)
					FROM users
					LEFT JOIN comptes_heberg
					ON users.u_nic = comptes_heberg.u_nic
					LEFT JOIN comptes_domain
					ON users.u_nic = comptes_domain.u_nic
					GROUP BY comptes_heberg.u_nic
					");
	
		if (($nb_users = mysql_num_rows($_list)) > 0) {
			while($list = mysql_fetch_array($_list)) {
				$tpl->assign_array('users', array(
					'u_nic' => $list['nic'],
					'nom' => utf8_encode($list['u_nom']),
					'prenom' => utf8_encode($list['u_prenom']),
					'u_portemonnaie' => round($list['u_portemonnaie'],2),
					'nb_heberg' => $list['COUNT(comptes_heberg.id)'],
					'nb_doms' => $list['COUNT(comptes_domain.id)'],
					));
				
			}
			$tpl->assign(array('nb_dom' => $nb_dom));
		}
		else
		{
			$tpl->assign(array('nb_dom' => 0));
		}
	
	
	
	
	
}
else { header("LOCATION: /site/index.html");}

?>